#include "Localization.h"
#include "Tests.h"
#include "TestFactory.h"
#include "TestKnowledgeBaseInterpreter.h"
#include "TestKnowledgeBaseWriter.h"
#include "TestWorkModeMenuText.h"
#include <iostream>

static const int expectedAssumptions = 80;

static int assumptionCounter = 0;

void TestAssumption
	( bool condition
	, std::string conditionStr
	, std::string suiteIdentity
	, std::string testIdentity
	, std::string fileName
	, int line
	)
{
	if ( condition )
		assumptionCounter++;
	else
	{
		std::cout << Localization ()->AssumptionFailed () << conditionStr << "\n\r";
		std::cout << Localization ()->AssumptionFile () << fileName << Localization ()->AssumptionLine () << line << "\n\r";
		std::cout << Localization ()->AssumptionSuite () << suiteIdentity << "\n\r";
		std::cout << Localization ()->AssumptionTest () << testIdentity << "\n\r";
		abort ();
	}
}

void RunAllTests ()
{
	assumptionCounter = 0;
	
	TestFactory::RunAllTests ();
	TestKnowledgeBaseInterpreter::RunAllTests ();
	TestKnowledgeBaseWriter::RunAllTests ();
	TestWorkModeMenuText::RunAllTests ();

	if ( assumptionCounter == expectedAssumptions )
		std::cout << assumptionCounter << Localization ()->AssumptionsSuccessfullyAsserted ( assumptionCounter ) << "\n\r";
	else
	{
		std::cout << Localization ()->AssumptionsCountMismatch ( assumptionCounter, expectedAssumptions ) << "\n\r";
		abort ();
	}
}
